﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using MySql.Data.MySqlClient;

namespace auxiliary_proj
{
    public partial class FormSalesOrderSummary : Form
    {
        int order_num;
        String unitname;
        String date;
        String approval;
        public FormSalesOrderSummary()
        {
            InitializeComponent();
        }
        public FormSalesOrderSummary(int order_num, String unitname, String date, String approval) {
            InitializeComponent();
            this.lbl_approved.Text = "" + approval;
            this.lbl_date_ordered.Text = "" + date;
            this.lbl_order_no.Text = "" + order_num;
            this.lbl_unitname.Text = "" + unitname;
            this.order_num = order_num;
            this.unitname = unitname;
            this.approval = approval;
            this.date = date;
            qSalesOrderSummary();
        }
        public void qSalesOrderSummary()
        {
            string query = "SELECT i.item_id AS item_no, i.description AS description, io.quantity AS quantity FROM ITEM_ORDER AS io, ITEM AS i WHERE io.item_id=i.item_id AND io.order_id='" + order_num + "'";
            try
            {
                formSalesOrderSummaryDGV.DataSource = Query.select(query);
            }
            catch (MySqlException exc) { MessageBox.Show(exc.Message); }
        }
    }
}
